#ifndef CGLOBALS_H
#define CGLOBALS_H

#include <QObject>
#include <QVector>

#include "gsmmodem.h"
#include "datasource.h"
#include "environment.h"
#include "parametergroup.h"
#include "recipient.h"
#include "mymodel.h"
#include "techparameter.h"
#include "alarm.h"
#include "log.h"
#include <QThread>

class CGlobals: public QObject
{
    Q_OBJECT
public:
    QVector<CTechParameter*> parameters;
    FUserBase userBase;
    QList<FAlarm*> alarms;
    QTimer updateTimer;
    QTimer updateParamTimer;
    QString SMSLogFilename;
    CLog log;

private:
    CGsmModem *modem;
    CMessageQueue queue;
    CEnvironment envi;
    MyModel *_model;



#ifdef WIN32
    HMODULE hDll;
#endif

    bool owenInit;

public:
    CGlobals();
    ~CGlobals();
    void cleanAll();

//GSM messaging functions:
    bool setupModem(unsigned int baud, unsigned char port);
    bool queueAddMessage(QString message,QString recipient);
    QString modemCmd(QString);

    bool setupOwen(unsigned int baud,unsigned char port);
    CValue owenRead(int address);

    MyModel* model(){return _model;}

    bool load(QString filename);
    bool save(QString filename);

public slots:
    void updateView();  //model view
    void updateParameters(); //parameter values + alarms

};

extern CGlobals *globals;

#endif // CGLOBALS_H
